package com.west_traveler.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.west_traveler.viewpager_adapter.SubscribePageViewPagerAdapter;
import com.west_traveler.ximalayafm.R;

/**
 * Description: 订阅听Fragment
 * Date:2016年12月02日15:10
 *
 * @author: 刘悦.
 */

public class SubScribeFragment extends Fragment{


    public static SubScribeFragment getInstance(){
        return new SubScribeFragment();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_subscribe, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        TabLayout tabLayout = (TabLayout) view.findViewById(R.id.tb_subscribe_id);
        ViewPager viewPager = (ViewPager) view.findViewById(R.id.vp_subscribe_id);
        tabLayout.setupWithViewPager(viewPager);

        String[] tabNames = getResources().getStringArray(R.array.sub_page_tab_names);

        SubscribePageViewPagerAdapter adapter = new SubscribePageViewPagerAdapter(getChildFragmentManager(),tabNames);
        viewPager.setAdapter(adapter);



    }
}
